package com.woniuxy.purchasemanager.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woniuxy.commons.entity.Dict;
import com.woniuxy.purchasemanager.dao.DictDao;
import com.woniuxy.purchasemanager.service.DictService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author:黄志超
 * @Todo:TODO
 * @DateTime:2022/4/20 17:20
 * @Component:蜗牛
 **/
@Service
public class DictServiceImpl extends ServiceImpl<DictDao, Dict> implements DictService {

    //返回数据
    @Override
    public Map<String, Object> findAll() {
        Map<String,Object> map = new HashMap<String,Object>();
        List<Dict> dicts = assemblyLine();
        List<Dict> condition = condition();
        map.put("assemblyLine",dicts);
        map.put("condition",condition);
        return map;
    }

    //查找产品线
    public List<Dict> assemblyLine(){
        QueryWrapper<Dict> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("parent_id",15);
        List<Dict> dicts = baseMapper.selectList(queryWrapper);
        return dicts;
    }
    //查找成色
    public List<Dict> condition(){
        QueryWrapper<Dict> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("parent_id",27);
        List<Dict> dicts = baseMapper.selectList(queryWrapper);
        return dicts;
    }

}
